package tt.dz.appserver.service.avro.test;

import java.io.IOException;
import java.net.InetSocketAddress;

import org.apache.avro.ipc.NettyServer;
import org.apache.avro.ipc.specific.SpecificResponder;

public class Server {

	private int port;

	public Server(int port) {
		this.port = port;
	}

	public void start() {
		try {
			new NettyServer(new SpecificResponder(MessageProtocol.class, new MessageProtocolImpl()),
					new InetSocketAddress(port));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) throws IOException {
		int port = 9512;
		System.out.println("Starting server");
		Server server = new Server(port);
		server.start();
		System.out.println("Server started");
	}
}
